﻿package{
	import flash.display.MovieClip;
	import flash.events.*;
	import flash.geom.Point;
	import GameManager;
	
	public class Level extends MovieClip{
		// constants for types of obstacles - Wall, Door, Exit, Pickup, Trap, Exit
		
		
		
		// level starting position for the character
		public var CharacterStart:Point = new Point();
		// level name
		public var levelName:String;
		//guard list 
		public var guards:Array = new Array();
		
		public function Level(){
			//listen for when the character is added to the play area
			addEventListener(Event.ADDED_TO_STAGE, onStage);
		}
		
		private function onStage(e:Event){
			//remove the added listener
			removeEventListener(Event.ADDED_TO_STAGE, onStage);
			
			//when removed from stage clean up after your self
			addEventListener(Event.REMOVED_FROM_STAGE, cleanUp);
			dispatchEvent(new Event("LevelLoaded"));
			// call an empty init function that subclasses can override
			init();
			
		}
		public function init(){
			//this function will be used in the sub classes to initialise the level	properties		
		}
		
		
		private function cleanUp(e:Event){
			removeEventListener(Event.REMOVED_FROM_STAGE, cleanUp);
		}	
		
		
	}
	
}